<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script type="text/javascript">

    function showTags(tagsString, containerId) {

    }

    function go() {
        showTags(document.getElementById("main_input").value, 'container');
        document.getElementById("container").innerHTML = '';
        var obj = document.getElementById("main_input").value;
        if (obj != null && obj != "") {
            var arr = obj.split(" ");
            for (var i = 0; i < arr.length; i++) {
                if (arr[i] != "") {
                    var el = document.createElement("span");
                    el.setAttribute("class", "tag");
                    el.innerHTML = arr[i];
                    document.getElementById("container").appendChild(el);
                }
            };
        }
    }
    </script>
    <style type="text/css">
        .tag {
            background-color: #DEB887;
            color: #f0a;
            margin: 5px;
            margin-right: 20px;
            padding: 5px;
            float: left;
        }
    </style>
</head>
<body>
<div class="">
    <input id="main_input">
    <button onclick="go();">Go!</button>
</div>
<div id="container"></div>
</body>
</html>